<?php
/*
 * @Author: your name
 * @Date: 2020-11-16 14:46:40
 * @LastEditTime: 2020-12-17 10:42:16
 * @LastEditors: Please set LastEditors
 * @Description: 规则预览验证器
 * @FilePath: /special/application/adminapiv3/validate/RulePreviewValidate.php
 */
namespace app\adminapiv3\validate;

use think\Validate;

class RulePreviewValidate extends Validate
{
    protected $rule = [
        //规则来源
        'source|规则来源' => 'alphaDash|length:6,20',
        //规则id
        'rule_id|规则来源ID' => 'number|length:1,10',
        //规则内容
        'content|规则内容' => 'dash|length:1,255',
        //排行
        'rank|排行值' => 'number|length:1,4',
        //主机id
        'host_id|主机ID' => 'require|number|length:1,10',
        //id
        'id|规则ID' => 'require|regex:^\d{1,10}(,\d{1,10}){0,}$'
    ];

    protected $scene = [
        //列表
        'list' => ['type','rule_id','content','host_id'],
        //排序
        'sort' => ['host_id','id'],
        //推送规则到客户端
        'push' => ['host_id'],
    ];
}